<?php
use Illuminate\Support\Facades\Route;

# 后台登录
Route::group(['prefix' => 'login', 'namespace' => 'Admin'], function () {
    Route::any('/', 'LoginController@login');
    Route::get('me', 'LoginController@me');
    Route::any('logout', 'LoginController@logout');
    Route::get('refresh', 'LoginController@refresh');
});

Route::group(['prefix' => 'permission', 'namespace' => 'Admin'], function () {
    # 后台用户
    Route::group(['prefix' => 'user'], function () {
        Route::post('/', 'UserController@index');
        Route::post('store', 'UserController@store');
        Route::put('update/{id}', 'UserController@update');
        Route::delete('destroy/{id}', 'UserController@destroy');
    });

    # 后台权限
    Route::group(['prefix' => 'permission'], function () {
        Route::get('/', 'PermissionController@index');
        Route::post('store', 'PermissionController@store');
        Route::put('update/{id}', 'PermissionController@update');
        Route::delete('destroy/{id}', 'PermissionController@destroy');
        Route::get('routes', 'PermissionController@permissionRoute');
    });

    # 角色
    Route::group(['prefix' => 'role'], function () {
        Route::post('/', 'RoleController@index');
        Route::post('store', 'RoleController@store');
        Route::put('update/{id}', 'RoleController@update');
        Route::delete('destroy/{id}', 'RoleController@destroy');
    });
});

# 文件上传
Route::group(['prefix' => 'upload', 'namespace' => 'Admin'], function () {
    Route::post('/', 'Upload@index');
});